<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: TableData::Table
  
    &mdash; Documentation by YARD 0.8.7.3
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (T)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../TableData.html" title="TableData (module)">TableData</a></span></span>
     &raquo; 
    <span class="title">Table</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: TableData::Table
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">TableData::Table</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
      <dt class="r2">Includes:</dt>
      <dd class="r2">Enumerable</dd>
      
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/tabledata/table.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>Table represents tabular data and provides various ways to create one, read
from it and represent it in a different format.</p>


  </div>
</div>
<div class="tags">
  

</div>
  <h2>Constant Summary</h2>
  
    <dl class="constants">
      
        <dt id="ValidOptions-constant" class="">ValidOptions =
          
        </dt>
        <dd><pre class="code"><span class='lbracket'>[</span><span class='symbol'>:has_headers</span><span class='comma'>,</span> <span class='symbol'>:has_footer</span><span class='comma'>,</span> <span class='symbol'>:file_type</span><span class='comma'>,</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='symbol'>:table_class</span><span class='comma'>,</span> <span class='symbol'>:accessors</span><span class='comma'>,</span> <span class='symbol'>:data</span><span class='comma'>,</span> <span class='symbol'>:header</span><span class='comma'>,</span> <span class='symbol'>:body</span><span class='comma'>,</span> <span class='symbol'>:footer</span><span class='rbracket'>]</span></pre></dd>
      
    </dl>
  




  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#accessor_columns-instance_method" title="#accessor_columns (instance method)">- (Hash&lt;Symbol =&gt; Integer&gt;) <strong>accessor_columns</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>A hash mapping column accessor names to the column index.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#accessors-instance_method" title="#accessors (instance method)">- (Array&lt;Symbol&gt;) <strong>accessors</strong> </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>An array of all named accessors.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#column_accessors-instance_method" title="#column_accessors (instance method)">- (Hash&lt;Integer =&gt; Symbol&gt;) <strong>column_accessors</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>A hash mapping column index to the column accessor names.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#name-instance_method" title="#name (instance method)">- (String<sup>?</sup>) <strong>name</strong> </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The name of the table.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#default_options-class_method" title="default_options (class method)">+ (Object) <strong>default_options</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The default options for TableData::Table#initialize Must be a method
because the values should be new objects each time.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#from_data-class_method" title="from_data (class method)">+ (Object) <strong>from_data</strong>(data, options = nil) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Create a table from a datastructure.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#from_file-class_method" title="from_file (class method)">+ (TableData::Table) <strong>from_file</strong>(path, options = nil) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Create a table from a file.</p>
</div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#%3C%3C-instance_method" title="#&lt;&lt; (instance method)">- (self) <strong>&lt;&lt;</strong>(row) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Append a row to the table.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#%3D%3D-instance_method" title="#== (instance method)">- (true, false) <strong>==</strong>(other) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>TODO: figure whether only data should be compared.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Array&lt;TableData::Row&gt;) <strong>[]</strong>(*args) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Array#[] like access to the rows in the body (excluding headers and footer)
of the table.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#accessors%3F-instance_method" title="#accessors? (instance method)">- (true, false) <strong>accessors?</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Whether accessors have been defined for this table.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#accessors_from_headers%21-instance_method" title="#accessors_from_headers! (instance method)">- (Object) <strong>accessors_from_headers!</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Automatically create accessors from the headers of the table.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#body-instance_method" title="#body (instance method)">- (Array&lt;TableData::Row&gt;) <strong>body</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>All rows except header and footer.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#cell-instance_method" title="#cell (instance method)">- (Object) <strong>cell</strong>(row, column, default = nil) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Access the value of a cell directly.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#column-instance_method" title="#column (instance method)">- (TableData::Column) <strong>column</strong>(index) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The column at the given index, accessor or name.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#column_accessor-instance_method" title="#column_accessor (instance method)">- (Symbol<sup>?</sup>) <strong>column_accessor</strong>(index) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The accessor defined for the given column index.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#column_count-instance_method" title="#column_count (instance method)">- (Integer<sup>?</sup>) <strong>column_count</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The number of columns.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#column_name-instance_method" title="#column_name (instance method)">- (String<sup>?</sup>) <strong>column_name</strong>(index) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The name defined for the given column index.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#columns-instance_method" title="#columns (instance method)">- (Array&lt;TableData::Column&gt;) <strong>columns</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>An array with the columns of this table.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#each-instance_method" title="#each (instance method)">- (self) <strong>each</strong> {|row| ... }</a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Iterate over all rows in the body.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#each_column-instance_method" title="#each_column (instance method)">- (self) <strong>each_column</strong> {|column| ... }</a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Iterate over all columns.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#each_row-instance_method" title="#each_row (instance method)">- (self) <strong>each_row</strong> {|row| ... }</a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Iterate over all rows, header and body.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#footer-instance_method" title="#footer (instance method)">- (TableData::Row<sup>?</sup>) <strong>footer</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The header row, if the table has a footer and the footer row is present.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#footer%3F-instance_method" title="#footer? (instance method)">- (true, false) <strong>footer?</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Whether this table has a footer.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#format-instance_method" title="#format (instance method)">- (TableData::Presenter) <strong>format</strong>(format_id, options = nil) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#headers-instance_method" title="#headers (instance method)">- (TableData::Row<sup>?</sup>) <strong>headers</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The header row, if the table has headers and the header row is present.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#headers%3F-instance_method" title="#headers? (instance method)">- (true, false) <strong>headers?</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Whether this table has headers.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#index_for_accessor-instance_method" title="#index_for_accessor (instance method)">- (Integer<sup>?</sup>) <strong>index_for_accessor</strong>(name) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The index for the given column-accessor.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#index_for_column-instance_method" title="#index_for_column (instance method)">- (Integer<sup>?</sup>) <strong>index_for_column</strong>(column) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The index for the given column-index, -accessor or -name.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#index_for_header-instance_method" title="#index_for_header (instance method)">- (Integer<sup>?</sup>) <strong>index_for_header</strong>(name) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The index for the given column-name.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Table) <strong>initialize</strong>(options = nil) </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Create a new table.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#inspect-instance_method" title="#inspect (instance method)">- (Object) <strong>inspect</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>See Object#inspect.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#row-instance_method" title="#row (instance method)">- (TableData::Row) <strong>row</strong>(row) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The row at the given row number (zero based).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#size-instance_method" title="#size (instance method)">- (Integer) <strong>size</strong> </a>
    

    
      (also: #length)
    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The number of rows, excluding headers and footer.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_a-instance_method" title="#to_a (instance method)">- (Object) <strong>to_a</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>TODO: figure the proper return value for this method (deep dup?).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_nested_array-instance_method" title="#to_nested_array (instance method)">- (Object) <strong>to_nested_array</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>TODO: figure whether this method is needed.</p>
</div></span>
  
</li>

      
    </ul>
  


  <div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="TableData::Table (class)">Table</a></span></tt>) <strong>initialize</strong>(options = nil) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Create a new table.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>A list of options. Mostly identical to <span class='object_link'><a href="#initialize-instance_method" title="TableData::Table#initialize (method)">#initialize</a></span>&#39;s options
hash, but with the additional options :file_type and :table_class.</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>options</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:name</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>The name of the table</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:accessors</span>
          <span class="type">(<tt>Array&lt;Symbol&gt;</tt>, <tt>Hash&lt;Symbol =&gt; Integer&gt;</tt>, <tt>nil</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>A list of accessors for the columns. Allows accessing columns by that
accessor.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:data</span>
          <span class="type">(<tt>Symbol</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>An array of arrays with the table data. Mutually exclusive with :header,
:body and :footer.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:header</span>
          <span class="type">(<tt>Symbol</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>An array with the header values. To be used together with :body and
:footer.<br> Mutually exclusive with :data.<br> Automatically sets
:has_headers to true.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:body</span>
          <span class="type">(<tt>Symbol</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>An array with the header values. To be used together with :header and
:footer.<br> Mutually exclusive with :data.<br> Automatically sets
:has_headers to false if :header is not also present.<br> Automatically
sets :has_footer to false if :footer is not also present.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:footer</span>
          <span class="type">(<tt>Symbol</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>An array with the header values. To be used together with :header and
:body.<br> Mutually exclusive with :data.<br> Automatically sets
:has_footer to true.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:has_headers</span>
          <span class="type">(<tt>true</tt>, <tt>false</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>Whether the table has a header, defaults to true</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:has_footer</span>
          <span class="type">(<tt>true</tt>, <tt>false</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>Whether the table has a footer, defaults to false</p>
</div>
          
        </li>
      
    </ul>
  

<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 148</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_options'>options</span>           <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_default_options'>default_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_default_options'>default_options</span>
  <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Invalid options: </span><span class='embexpr_beg'>#{</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='op'>-</span><span class='const'>ValidOptions</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='lbracket'>[</span><span class='int'>1</span><span class='op'>..</span><span class='op'>-</span><span class='int'>2</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='op'>-</span><span class='const'>ValidOptions</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>

  <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:data</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Must not mix :data with :header, :body or :footer</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:header</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:body</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:footer</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:data</span><span class='rparen'>)</span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
    <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:header</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_data'>data</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:header</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:has_headers</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span>
    <span class='kw'>end</span>
    <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_concat'>concat</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:body</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:body</span><span class='rparen'>)</span>
    <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:footer</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_data'>data</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:footer</span><span class='rparen'>)</span>
      <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:has_footer</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_column_count'>column_count</span>      <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>?</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>:</span> <span class='int'>0</span>
  <span class='ivar'>@name</span>             <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span>
  <span class='ivar'>@has_headers</span>      <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:has_headers</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
  <span class='ivar'>@has_footer</span>       <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:has_footer</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
  <span class='ivar'>@data</span>             <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span>
  <span class='ivar'>@header_columns</span>   <span class='op'>=</span> <span class='kw'>nil</span>                        <span class='comment'># used for cell access by header name, e.g. table[0][&quot;Some Cellname&quot;]
</span>  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_accessors'>accessors</span>    <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:accessors</span><span class='rparen'>)</span> <span class='comment'># used for cell access by accessor, e.g. table[0][:some_cell_accessor]
</span>  <span class='ivar'>@rows</span>             <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='period'>.</span><span class='id identifier rubyid_with_index'>with_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidColumnCount</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Invalid column count in row </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_index'>index</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_column_count'>column_count</span><span class='embexpr_end'>}</span><span class='tstring_content'> expected, but has </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_index'>index</span> <span class='op'>&gt;</span> <span class='int'>0</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>!=</span> <span class='id identifier rubyid_column_count'>column_count</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Row must be provided as Array, but got </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> in row </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_index'>index</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>

    <span class='const'>Row</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
  <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="accessor_columns-instance_method">
  
    - (<tt>Hash&lt;Symbol =&gt; Integer&gt;</tt>) <strong>accessor_columns</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns A hash mapping column accessor names to the column index</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash&lt;Symbol =&gt; Integer&gt;</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>A hash mapping column accessor names to the column index</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


105
106
107</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 105</span>

<span class='kw'>def</span> <span class='id identifier rubyid_accessor_columns'>accessor_columns</span>
  <span class='ivar'>@accessor_columns</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="accessors=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="accessors-instance_method">
  
    - (<tt>Array&lt;Symbol&gt;</tt>) <strong>accessors</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns An array of all named accessors</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array&lt;Symbol&gt;</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>An array of all named accessors</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


102
103
104</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 102</span>

<span class='kw'>def</span> <span class='id identifier rubyid_accessors'>accessors</span>
  <span class='ivar'>@accessors</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="column_accessors-instance_method">
  
    - (<tt>Hash&lt;Integer =&gt; Symbol&gt;</tt>) <strong>column_accessors</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns A hash mapping column index to the column accessor names</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash&lt;Integer =&gt; Symbol&gt;</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>A hash mapping column index to the column accessor names</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


108
109
110</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 108</span>

<span class='kw'>def</span> <span class='id identifier rubyid_column_accessors'>column_accessors</span>
  <span class='ivar'>@column_accessors</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="name-instance_method">
  
    - (<tt>String</tt><sup>?</sup>) <strong>name</strong>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The name of the table</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The name of the table</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


115
116
117</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 115</span>

<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
  <span class='ivar'>@name</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="default_options-class_method">
  
    + (<tt>Object</tt>) <strong>default_options</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>The default options for TableData::Table#initialize Must be a method
because the values should be new objects each time</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


22
23
24
25
26
27
28
29</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 22</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_options'>default_options</span>
  <span class='lbrace'>{</span>
    <span class='label'>has_headers:</span> <span class='kw'>true</span><span class='comma'>,</span>
    <span class='label'>has_footer:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='comment'># currently unused
</span>    <span class='label'>accessors:</span>  <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span>
    <span class='label'>name:</span>       <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Unnamed Table</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
  <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="from_data-class_method">
  
    + (<tt>Object</tt>) <strong>from_data</strong>(data, options = nil) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Create a table from a datastructure.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>data</span>
      
      
        <span class='type'>(<tt>Array&lt;Array&gt;</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>An array of arrays, representing rows -&gt; cells.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>A list of options. Many are identical to <span class='object_link'><a href="#initialize-instance_method" title="TableData::Table#initialize (method)">#initialize</a></span>&#39;s options
hash, but with the additional options :file_type and :table_class. The
:data option is used by from_file and thus overridden and can&#39;t be
used. For the same reason, :header, :footer and :body can&#39;t be used.</p>
</div>
      
    </li>
  
</ul>

  
    
    
    
    
    <p class="tag_title">Options Hash (<tt>options</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:file_type</span>
          <span class="type">(<tt>Symbol</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>The file type. Nil for auto-detection (which uses the extension of the
filename), or one of :csv, :xls or :xlsx</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:table_class</span>
          <span class="type">(<tt>Symbol</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>The class to use for this table. Defaults to self (TableData::Table)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:name</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>The name of the table</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:accessors</span>
          <span class="type">(<tt>Array&lt;Symbol&gt;</tt>, <tt>Hash&lt;Symbol =&gt; Integer&gt;</tt>, <tt>nil</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>A list of accessors for the columns. Allows accessing columns by that
accessor.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:has_headers</span>
          <span class="type">(<tt>true</tt>, <tt>false</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>Whether the table has a header, defaults to true</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:has_footer</span>
          <span class="type">(<tt>true</tt>, <tt>false</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>Whether the table has a footer, defaults to false</p>
</div>
          
        </li>
      
    </ul>
  


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


97
98
99</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 97</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_data'>from_data</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>?</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>data:</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='label'>data:</span> <span class='id identifier rubyid_data'>data</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="from_file-class_method">
  
    + (<tt><span class='object_link'><a href="" title="TableData::Table (class)">TableData::Table</a></span></tt>) <strong>from_file</strong>(path, options = nil) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Create a table from a file.<br> See <span class='object_link'><a href="../TableData.html" title="TableData (module)">TableData</a></span> docs for a list of
supported file types.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>path</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The path to a file in one of the supported formats.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>A list of options. Many are identical to <span class='object_link'><a href="#initialize-instance_method" title="TableData::Table#initialize (method)">#initialize</a></span>&#39;s options
hash, but with the additional options :file_type and :table_class. The
:data option is used by from_file and thus overridden and can&#39;t be
used. For the same reason, :header, :footer and :body can&#39;t be used.</p>
</div>
      
    </li>
  
</ul>

  
    
    
    
    
    <p class="tag_title">Options Hash (<tt>options</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:file_type</span>
          <span class="type">(<tt>Symbol</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>The file type. Nil for auto-detection (which uses the extension of the
filename), or one of :csv, :xls or :xlsx</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:name</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>The name of the table. Defaults to the basename of the file without the
suffix.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:accessors</span>
          <span class="type">(<tt>Array&lt;Symbol&gt;</tt>, <tt>Hash&lt;Symbol =&gt; Integer&gt;</tt>, <tt>nil</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>A list of accessors for the columns. Allows accessing columns by that
accessor.</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:has_headers</span>
          <span class="type">(<tt>true</tt>, <tt>false</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>Whether the table has a header, defaults to true</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:has_footer</span>
          <span class="type">(<tt>true</tt>, <tt>false</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>Whether the table has a footer, defaults to false</p>
</div>
          
        </li>
      
    </ul>
  

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="TableData::Table (class)">TableData::Table</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


57
58
59
60
61
62
63
64
65
66
67
68
69</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 57</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_file'>from_file</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_options'>options</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
  <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:table_class</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='kw'>self</span>
  <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:file_type</span><span class='rbracket'>]</span>   <span class='op'>||=</span> <span class='const'>Detection</span><span class='period'>.</span><span class='id identifier rubyid_file_type_from_path'>file_type_from_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span>        <span class='op'>||=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_sub'>sub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.(?:csv|xlsx?)\z</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>

  <span class='kw'>case</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:file_type</span><span class='rbracket'>]</span>
    <span class='kw'>when</span> <span class='symbol'>:csv</span> <span class='kw'>then</span> <span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_parse_csv'>parse_csv</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='kw'>when</span> <span class='symbol'>:xls</span> <span class='kw'>then</span> <span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_table_from_xls'>table_from_xls</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='kw'>when</span> <span class='symbol'>:xlsx</span> <span class='kw'>then</span> <span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_table_from_xlsx'>table_from_xlsx</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
    <span class='kw'>else</span> <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidFileType</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Unknown file format </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:file_type</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="<<-instance_method">
  
    - (<tt>self</tt>) <strong>&lt;&lt;</strong>(row) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Append a row to the table.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>row</span>
      
      
        <span class='type'>(<tt>Array</tt>, <tt>#to_ary</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The row to append to the table</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>self</tt>)</span>
      
      
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="InvalidColumnCount.html" title="TableData::InvalidColumnCount (class)">InvalidColumnCount</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


369
370
371
372
373
374
375
376
377
378
379
380
381
382
383</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 369</span>

<span class='kw'>def</span> <span class='op'>&lt;&lt;</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_index'>index</span>  <span class='op'>=</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
  <span class='kw'>begin</span>
    <span class='id identifier rubyid_row'>row</span> <span class='op'>=</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_to_ary'>to_ary</span>
  <span class='kw'>rescue</span> <span class='const'>NoMethodError</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Row must be provided as Array or respond to `to_ary`, but got </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'> in row </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_index'>index</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:to_ary</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_raise'>raise</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidColumnCount</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Invalid column count in row </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_index'>index</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'> expected, but has </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>!=</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>

  <span class='ivar'>@data</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_row'>row</span>
  <span class='ivar'>@rows</span> <span class='op'>&lt;&lt;</span> <span class='const'>Row</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>

  <span class='kw'>self</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="==-instance_method">
  
    - (<tt>true</tt>, <tt>false</tt>) <strong>==</strong>(other) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>This method might be changed</p>
</div>
  </div>


<p>TODO: figure whether only data should be compared</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Whether this table has the same content and properties (name, has_headers,
has_footer, accessors) as another table</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


453
454
455
456
457
458
459
460
461
462</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 453</span>

<span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
  <span class='lparen'>(</span>
    <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>TableData</span><span class='op'>::</span><span class='const'>Table</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span>
    <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>      <span class='op'>==</span> <span class='ivar'>@name</span> <span class='op'>&amp;&amp;</span>
    <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_headers?'>headers?</span>  <span class='op'>==</span> <span class='ivar'>@has_headers</span> <span class='op'>&amp;&amp;</span>
    <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_footer?'>footer?</span>   <span class='op'>==</span> <span class='ivar'>@has_footer</span> <span class='op'>&amp;&amp;</span>
    <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_accessors'>accessors</span> <span class='op'>==</span> <span class='ivar'>@accessors</span> <span class='op'>&amp;&amp;</span>
    <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span>      <span class='op'>==</span> <span class='id identifier rubyid_data'>data</span>
  <span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="[]-instance_method">
  
    - (<tt>Array&lt;<span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span>&gt;</tt>) <strong>[]</strong>(*args) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Array#[] like access to the rows in the body (excluding headers and footer)
of the table.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span>&gt;</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


236
237
238</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 236</span>

<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_body'>body</span><span class='lbracket'>[</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="accessors?-instance_method">
  
    - (<tt>true</tt>, <tt>false</tt>) <strong>accessors?</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns Whether accessors have been defined for this table</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Whether accessors have been defined for this table</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


321
322
323</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 321</span>

<span class='kw'>def</span> <span class='id identifier rubyid_accessors?'>accessors?</span>
  <span class='op'>!</span><span class='ivar'>@accessors</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="accessors_from_headers!-instance_method">
  
    - (<tt>Object</tt>) <strong>accessors_from_headers!</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>The actual transformation algorithm might change in the future.</p>
</div>
  </div>


<p>Automatically create accessors from the headers of the table. It does that
by downcasing the headers, replace everything which is not in [a-z0-9_]
with an _, replace all repeated occurrences of _ with a single _.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


189
190
191
192
193</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 189</span>

<span class='kw'>def</span> <span class='id identifier rubyid_accessors_from_headers!'>accessors_from_headers!</span>
  <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Can&#39;t define accessors from headers in a table without headers</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='ivar'>@has_headers</span>

  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_accessors'>accessors</span> <span class='op'>=</span> <span class='id identifier rubyid_headers'>headers</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_val'>val</span><span class='op'>|</span> <span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_tr'>tr</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>^a-z0-9_</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>_</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_squeeze'>squeeze</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>_</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A_|_\z</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='op'>:</span> <span class='kw'>nil</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="body-instance_method">
  
    - (<tt>Array&lt;<span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span>&gt;</tt>) <strong>body</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns All rows except header and footer.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span>&gt;</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>All rows except header and footer.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


353
354
355
356
357
358
359
360
361</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 353</span>

<span class='kw'>def</span> <span class='id identifier rubyid_body'>body</span>
  <span class='id identifier rubyid_end_offset'>end_offset</span> <span class='op'>=</span> <span class='id identifier rubyid_footer?'>footer?</span> <span class='op'>?</span> <span class='op'>-</span><span class='int'>2</span> <span class='op'>:</span> <span class='op'>-</span><span class='int'>1</span>

  <span class='kw'>if</span> <span class='id identifier rubyid_headers?'>headers?</span>
    <span class='ivar'>@rows</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='ivar'>@rows</span><span class='lbracket'>[</span><span class='int'>1</span><span class='op'>..</span><span class='id identifier rubyid_end_offset'>end_offset</span><span class='rbracket'>]</span>
  <span class='kw'>else</span>
    <span class='ivar'>@rows</span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_end_offset'>end_offset</span><span class='rbracket'>]</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="cell-instance_method">
  
    - (<tt>Object</tt>) <strong>cell</strong>(row, column, default = nil) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>This method&#39;s signature will probably change soon.</p>
</div>
  </div>


<p>Access the value of a cell directly</p>

<p>TODO: Figure out how to properly deal with out-of-bounds access.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


245
246
247
248
249
250
251
252
253
254
255</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 245</span>

<span class='kw'>def</span> <span class='id identifier rubyid_cell'>cell</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='comma'>,</span> <span class='id identifier rubyid_column'>column</span><span class='comma'>,</span> <span class='id identifier rubyid_default'>default</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_row_data'>row_data</span> <span class='op'>=</span> <span class='id identifier rubyid_row'>row</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>

  <span class='kw'>if</span> <span class='id identifier rubyid_row_data'>row_data</span>
    <span class='id identifier rubyid_row_data'>row_data</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
  <span class='kw'>elsif</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
    <span class='kw'>yield</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_row'>row</span><span class='comma'>,</span> <span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_default'>default</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="column-instance_method">
  
    - (<tt><span class='object_link'><a href="Column.html" title="TableData::Column (class)">TableData::Column</a></span></tt>) <strong>column</strong>(index) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The column at the given index, accessor or name.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Column.html" title="TableData::Column (class)">TableData::Column</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The column at the given index, accessor or name.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


287
288
289</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 287</span>

<span class='kw'>def</span> <span class='id identifier rubyid_column'>column</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
  <span class='const'>Column</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_index_for_column'>index_for_column</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="column_accessor-instance_method">
  
    - (<tt>Symbol</tt><sup>?</sup>) <strong>column_accessor</strong>(index) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The accessor defined for the given column index.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Symbol</tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The accessor defined for the given column index.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


265
266
267</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 265</span>

<span class='kw'>def</span> <span class='id identifier rubyid_column_accessor'>column_accessor</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
  <span class='ivar'>@column_accessors</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="column_count-instance_method">
  
    - (<tt>Integer</tt><sup>?</sup>) <strong>column_count</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The number of columns. Nil if no rows are present.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The number of columns. Nil if no rows are present.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


228
229
230</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 228</span>

<span class='kw'>def</span> <span class='id identifier rubyid_column_count'>column_count</span>
  <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>?</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>:</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="column_name-instance_method">
  
    - (<tt>String</tt><sup>?</sup>) <strong>column_name</strong>(index) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>The name defined for the given column index.<br> The name is determined by
the column&#39;s header. Returns nil if the table has no headers.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The name defined for the given column index.<br> The name is determined by
the column&#39;s header. Returns nil if the table has no headers.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


273
274
275
276
277</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 273</span>

<span class='kw'>def</span> <span class='id identifier rubyid_column_name'>column_name</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='id identifier rubyid_headers'>headers</span>

  <span class='id identifier rubyid_h'>h</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="columns-instance_method">
  
    - (<tt>Array&lt;<span class='object_link'><a href="Column.html" title="TableData::Column (class)">TableData::Column</a></span>&gt;</tt>) <strong>columns</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns An array with the columns of this table</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Column.html" title="TableData::Column (class)">TableData::Column</a></span>&gt;</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>An array with the columns of this table</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


281
282
283</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 281</span>

<span class='kw'>def</span> <span class='id identifier rubyid_columns'>columns</span>
  <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_column_count'>column_count</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</span><span class='op'>|</span> <span class='id identifier rubyid_column'>column</span><span class='lparen'>(</span><span class='id identifier rubyid_col'>col</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="each-instance_method">
  
    - (<tt>self</tt>) <strong>each</strong> {|row| ... }
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Iterate over all rows in the body</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>row</tt>)</span>
      
      
      
    </li>
  
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
  
    <li>
      
        <span class='name'></span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>self</tt>)</span>
      
      
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li><span class='object_link'><a href="#each_row-instance_method" title="TableData::Table#each_row (method)">A method which iterates over all rows, including headers</a></span></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


393
394
395
396
397
398
399</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 393</span>

<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='id identifier rubyid_enum_for'>enum_for</span><span class='lparen'>(</span><span class='id identifier rubyid___method__'>__method__</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>

  <span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>

  <span class='kw'>self</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="each_column-instance_method">
  
    - (<tt>self</tt>) <strong>each_column</strong> {|column| ... }
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Iterate over all columns</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>column</tt>)</span>
      
      
      
    </li>
  
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
  
    <li>
      
        <span class='name'></span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Column.html" title="TableData::Column (class)">TableData::Column</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>self</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


423
424
425
426
427
428
429
430
431</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 423</span>

<span class='kw'>def</span> <span class='id identifier rubyid_each_column'>each_column</span>
  <span class='kw'>return</span> <span class='id identifier rubyid_enum_for'>enum_for</span><span class='lparen'>(</span><span class='id identifier rubyid___method__'>__method__</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>

  <span class='id identifier rubyid_column_count'>column_count</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
    <span class='kw'>yield</span> <span class='id identifier rubyid_column'>column</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='kw'>self</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="each_row-instance_method">
  
    - (<tt>self</tt>) <strong>each_row</strong> {|row| ... }
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Iterate over all rows, header and body</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>row</tt>)</span>
      
      
      
    </li>
  
</ul>
<p class="tag_title">Yield Parameters:</p>
<ul class="yieldparam">
  
    <li>
      
        <span class='name'></span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>self</tt>)</span>
      
      
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li><span class='object_link'><a href="#each-instance_method" title="TableData::Table#each (method)">A method which iterates only over body-rows</a></span></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


409
410
411
412
413
414
415</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 409</span>

<span class='kw'>def</span> <span class='id identifier rubyid_each_row'>each_row</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='id identifier rubyid_enum_for'>enum_for</span><span class='lparen'>(</span><span class='id identifier rubyid___method__'>__method__</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block'>block</span>

  <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>

  <span class='kw'>self</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="footer-instance_method">
  
    - (<tt><span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span></tt><sup>?</sup>) <strong>footer</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The header row, if the table has a footer and the footer row is
present. Nil otherwise.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span></tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The header row, if the table has a footer and the footer row is present.
Nil otherwise.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


347
348
349</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 347</span>

<span class='kw'>def</span> <span class='id identifier rubyid_footer'>footer</span>
  <span class='op'>!</span><span class='id identifier rubyid_footer?'>footer?</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='id identifier rubyid_headers?'>headers?</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@rows</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>&lt;</span> <span class='int'>2</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='ivar'>@rows</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="footer?-instance_method">
  
    - (<tt>true</tt>, <tt>false</tt>) <strong>footer?</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns Whether this table has a footer</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Whether this table has a footer</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


340
341
342</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 340</span>

<span class='kw'>def</span> <span class='id identifier rubyid_footer?'>footer?</span>
  <span class='ivar'>@has_footer</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="format-instance_method">
  
    - (<tt><span class='object_link'><a href="Presenter.html" title="TableData::Presenter (class)">TableData::Presenter</a></span></tt>) <strong>format</strong>(format_id, options = nil) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Presenter.html" title="TableData::Presenter (class)">TableData::Presenter</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


465
466
467</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 465</span>

<span class='kw'>def</span> <span class='id identifier rubyid_format'>format</span><span class='lparen'>(</span><span class='id identifier rubyid_format_id'>format_id</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='const'>Presenter</span><span class='period'>.</span><span class='id identifier rubyid_present'>present</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_format_id'>format_id</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="headers-instance_method">
  
    - (<tt><span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span></tt><sup>?</sup>) <strong>headers</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The header row, if the table has headers and the header row is
present. Nil otherwise.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span></tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The header row, if the table has headers and the header row is present. Nil
otherwise.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


334
335
336</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 334</span>

<span class='kw'>def</span> <span class='id identifier rubyid_headers'>headers</span>
  <span class='id identifier rubyid_headers?'>headers?</span> <span class='op'>?</span> <span class='ivar'>@rows</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>:</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="headers?-instance_method">
  
    - (<tt>true</tt>, <tt>false</tt>) <strong>headers?</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns Whether this table has headers</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>Whether this table has headers</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


327
328
329</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 327</span>

<span class='kw'>def</span> <span class='id identifier rubyid_headers?'>headers?</span>
  <span class='ivar'>@has_headers</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="index_for_accessor-instance_method">
  
    - (<tt>Integer</tt><sup>?</sup>) <strong>index_for_accessor</strong>(name) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The index for the given column-accessor.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The index for the given column-accessor.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


304
305
306</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 304</span>

<span class='kw'>def</span> <span class='id identifier rubyid_index_for_accessor'>index_for_accessor</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
  <span class='ivar'>@accessor_columns</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="index_for_column-instance_method">
  
    - (<tt>Integer</tt><sup>?</sup>) <strong>index_for_column</strong>(column) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The index for the given column-index, -accessor or -name.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The index for the given column-index, -accessor or -name.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


293
294
295
296
297
298
299
300</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 293</span>

<span class='kw'>def</span> <span class='id identifier rubyid_index_for_column'>index_for_column</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
  <span class='kw'>case</span> <span class='id identifier rubyid_column'>column</span>
    <span class='kw'>when</span> <span class='const'>Integer</span> <span class='kw'>then</span> <span class='id identifier rubyid_column'>column</span>
    <span class='kw'>when</span> <span class='const'>Symbol</span>  <span class='kw'>then</span> <span class='id identifier rubyid_index_for_accessor'>index_for_accessor</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
    <span class='kw'>when</span> <span class='const'>String</span>  <span class='kw'>then</span> <span class='id identifier rubyid_index_for_header'>index_for_header</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
    <span class='kw'>else</span> <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidColumnSpecifier</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Invalid index type, expected Symbol, String or Integer, but got </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="index_for_header-instance_method">
  
    - (<tt>Integer</tt><sup>?</sup>) <strong>index_for_header</strong>(name) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The index for the given column-name.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The index for the given column-name.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


310
311
312
313
314
315
316
317</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 310</span>

<span class='kw'>def</span> <span class='id identifier rubyid_index_for_header'>index_for_header</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='ivar'>@has_headers</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='kw'>then</span>
    <span class='ivar'>@header_columns</span> <span class='op'>||=</span> <span class='const'>Hash</span><span class='lbracket'>[</span><span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='rbracket'>]</span>
    <span class='ivar'>@header_columns</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span>
  <span class='kw'>else</span>
    <span class='kw'>nil</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="inspect-instance_method">
  
    - (<tt>Object</tt>) <strong>inspect</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>See Object#inspect</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


470
471
472</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 470</span>

<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
  <span class='id identifier rubyid_sprintf'>sprintf</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>#&lt;%s headers: %p, footer: %p, cols: %s, rows: %d&gt;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='comma'>,</span> <span class='id identifier rubyid_headers?'>headers?</span><span class='comma'>,</span> <span class='id identifier rubyid_footer?'>footer?</span><span class='comma'>,</span> <span class='id identifier rubyid_column_count'>column_count</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>-</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_size'>size</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="row-instance_method">
  
    - (<tt><span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span></tt>) <strong>row</strong>(row) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The row at the given row number (zero based). Includes headers and
footer.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Row.html" title="TableData::Row (class)">TableData::Row</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The row at the given row number (zero based). Includes headers and footer.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


259
260
261</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 259</span>

<span class='kw'>def</span> <span class='id identifier rubyid_row'>row</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
  <span class='ivar'>@rows</span><span class='lbracket'>[</span><span class='id identifier rubyid_row'>row</span><span class='rbracket'>]</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="size-instance_method">
  
    - (<tt>Integer</tt>) <strong>size</strong> 
  

  
    <span class="aliases">Also known as:
    <span class="names"><span id='length-instance_method'>length</span></span>
    </span>
  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns The number of rows, excluding headers and footer</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Integer</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>The number of rows, excluding headers and footer</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


220
221
222
223
224</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 220</span>

<span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span>
  <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='ivar'>@has_headers</span> <span class='op'>?</span> <span class='int'>1</span> <span class='op'>:</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='ivar'>@has_footer</span> <span class='op'>?</span> <span class='int'>1</span> <span class='op'>:</span> <span class='int'>0</span><span class='rparen'>)</span>

  <span class='id identifier rubyid_result'>result</span> <span class='op'>&lt;</span> <span class='int'>0</span> <span class='op'>?</span> <span class='int'>0</span> <span class='op'>:</span> <span class='id identifier rubyid_result'>result</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_a-instance_method">
  
    - (<tt>Object</tt>) <strong>to_a</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>This method might be changed</p>
</div>
  </div>


<p>TODO: figure the proper return value for this method (deep dup?)</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


443
444
445</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 443</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_a'>to_a</span>
  <span class='ivar'>@data</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_nested_array-instance_method">
  
    - (<tt>Object</tt>) <strong>to_nested_array</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>This method might be removed</p>
</div>
  </div>


<p>TODO: figure whether this method is needed.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


436
437
438</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/tabledata/table.rb', line 436</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_nested_array'>to_nested_array</span>
  <span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_a</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Sun Feb 23 13:33:19 2014 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.3 (ruby-2.1.0).
</div>

  </body>
</html>